﻿using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

	public float speed = 2.5f;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		//make director
		Vector2 d = new Vector2 (0, 0);
		if (Input.GetKey (KeyCode.W))
			d.y = 1;
		if (Input.GetKey (KeyCode.S))
			d.y = -1;
		if (Input.GetKey (KeyCode.A))
			d.x = -1;
		if (Input.GetKey (KeyCode.D))
			d.x = 1;
		//move
		this.GetComponent<Rigidbody2D> ().velocity = d * speed;

	}
}
